package com.smart.home.utils;

import org.apache.commons.codec.digest.DigestUtils;

import javax.servlet.http.HttpServletRequest;


/**
 *  设备指纹工具类
 */
public class DeviceFingerprintUtil {

    public static String getFingerprint(HttpServletRequest request) {
        String userAgent = request.getHeader("User-Agent");
        String ip = request.getRemoteAddr();
        String acceptLanguage = request.getHeader("Accept-Language");

        // 使用SHA256生成唯一指纹
        String raw = ip + userAgent + acceptLanguage;
        return DigestUtils.sha256Hex(raw);
    }
}
